package com.briup.web.listener;

import com.briup.bean.ShopCar;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

@WebListener
public class SessionLinstener implements HttpSessionListener {
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        //为每一个用户准备一个购物车
        ShopCar shopCar = new ShopCar();
        se.getSession().setAttribute("shopCar",shopCar);
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        HttpSessionListener.super.sessionDestroyed(se);
    }
}